package com.sang.lesson02;

import com.sang.lesson02.utils.JdbcUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;


public class TestUpdate {
    public static void main(String[] args) {
        Connection conn =null;
        Statement st = null;
        ResultSet rs =null;

        try {
            conn = JdbcUtils.getConnection();//获取数据库连接
            st = conn.createStatement();//获取SQL执行对象

            String sql = "UPDATE users SET `NAME` = 'kuangshen',`email`='24736743@qq.com' WHERE id=1";

            int i = st.executeUpdate(sql);
            if(i>0){
                System.out.println("更新成功！");
            }

            JdbcUtils.release(conn,st,rs);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
